package org.jc.subject.application.convert;

import org.jc.subject.application.dto.SubjectCategoryDTO;
import org.jc.subject.domain.entity.SubjectCategoryBO;
import org.mapstruct.BeanMapping;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 * 功能描述
 *
 * @author wanghongqian
 * @date 2024/06/18 00:20
 */
@Mapper
public interface SubjectCategoryDTOConverter {

    SubjectCategoryDTOConverter INSTANCE = Mappers.getMapper(SubjectCategoryDTOConverter.class);

    SubjectCategoryBO convertDTOToBO(SubjectCategoryDTO subjectCategoryDTO);

    @Mapping(source = "id",target = "parentId")
    @BeanMapping(ignoreByDefault = true)
    SubjectCategoryBO convertDTOToBOIdToParentId(SubjectCategoryDTO subjectCategoryDTO);

    @Mapping(source = "id",target = "id")
    @BeanMapping(ignoreByDefault = true)
    SubjectCategoryBO convertDTOToBOId(SubjectCategoryDTO subjectCategoryDTO);

    List<SubjectCategoryDTO> convertBOToDTO(List<SubjectCategoryBO> subjectCategoryBOList);
}
